﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.ClickCricket.bll;

public partial class CreateBlog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        string name="";
        if (RadioButtonList1.SelectedIndex == 0)
            name = "Anonymous";
        else
            name = TxtName.Text;
        List<com.ClickCricket.bll.Blog> _blogList = BlogService.Instance.getBlogs();

        com.ClickCricket.bll.Blog blg = new com.ClickCricket.bll.Blog(_blogList.Count + 1, TxtTitle.Text, TxtData.Text + "\nBy " + name, System.DateTime.Now);
        BlogService.Instance.SetBlog(blg);
        Response.Redirect("~/Blog.aspx");
    }
    protected void BtnReset_Click(object sender, EventArgs e)
    {
        TxtName.Enabled = false;
        TxtName.Text = "";
        TxtData.Text = "";
        TxtTitle.Text = "";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Blog.aspx");
    }

    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
